﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using QLPKWeb.Models.LinQ.Error;
using QLPKWeb.Models.LinQ.History;
using Webdiyer.WebControls.Mvc;
using DONGACS.Common;


namespace QLPKWeb.BussinessDelegate.HistoryDelegate
{
    public class HistoryDelegate
    {
        DBHistoryDataContext DBHistory = new DBHistoryDataContext();

        //Ghi nhận lại thông tin user thao tác khi sử dụng hệ thống
        public void SaveToHistory(string module, string action, string url)
        {
            string[] urlItems = url.Split('/');
            var error = new TB_History()
            {
                UserID = Convert.ToInt32(HttpContext.Current.Session["USERID"]),
                CreateDate = DateTime.Now,
                Module = module,
                Action = action,
                Url = url
            };
            DBHistory.TB_Histories.InsertOnSubmit(error);
            DBHistory.SubmitChanges();
        }
    }
}